package com.huaxin.hxmoduleworkorder.models;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.huaxin.hxmoduleworkorder.common.StringListToJsonTypeHandler;
import com.huaxin.hxmoduleworkorder.common.enums.OrderType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("customer_evaluation")
@EqualsAndHashCode(callSuper = true)
public class CustomerEvaluation extends BaseModel {
    @TableField(value = "order_type")
    @Schema(description = "工单类型", example = "maintenance")
    private OrderType orderType;

    @TableField(value = "maintenance_order_id")
    @Schema(description = "工单ID", example = "mnt_order_001")
    private String maintenanceOrderId;

    @TableField(value = "order_title")
    @Schema(description = "工单标题", example = "2023年1月1日-2023年1月31日")
    private String orderTitle;

    @TableField(value = "customer_id")
    @Schema(description = "客户ID", example = "c1001")
    private String customerId;

    @TableField(value = "customer_name")
    @Schema(description = "客户名称", example = "海天酱油股份有限公司")
    private String customerName;

    @TableField(value = "customer_phone")
    @Schema(description = "客户手机号码", example = "13800000000")
    private String customerPhone;

    @TableField(value = "rating")
    @Schema(description = "评分：1-5星", example = "5")
    private Integer rating;

    @TableField(value = "comment")
    @Schema(description = "评价内容", example = "服务专业，响应迅速")
    private String comment;

    @TableField(value = "electrician_ids", typeHandler = StringListToJsonTypeHandler.class)
    @Schema(description = "被评价的电工ID列表", example = "[\"e1001\"]")
    private List<String> electricianIds;

    @TableField(value = "is_anonymous")
    @Schema(description = "是否匿名评价", example = "0")
    private Integer isAnonymous;

    @TableField(value = "reply_user_id")
    @Schema(description = "回复人ID", example = "rep_001")
    private String replyUserId;

    @TableField(value = "reply_user_name")
    @Schema(description = "回复人用户名", example = "回复人用户名")
    private String replyUserName;

    @TableField(value = "reply_content")
    @Schema(description = "回复内容", example = "回复内容")
    private String replyContent;

    @TableField(value = "reply_time")
    @Schema(description = "回复时间", example = "2023-01-01 00:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime replyTime;
}